/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, #3498db, #2ecc71);
    border-radius: 2px;
}

h2 {
    color: #34495e;
    margin: 25px 0 15px 0;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

/* 盒子模型比较区域 */
.model-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.box-model-example {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 标准盒子模型 */
.standard-box {
    width: 200px;
    height: 100px;
    padding: 20px;
    border: 5px solid #e74c3c;
    margin: 20px auto;
    background-color: #f9e79f;
    box-sizing: content-box; /* 标准盒子模型 */
}

/* IE盒子模型 */
.ie-box {
    width: 200px;
    height: 100px;
    padding: 20px;
    border: 5px solid #2ecc71;
    margin: 20px auto;
    background-color: #d5f5e3;
    box-sizing: border-box; /* IE盒子模型 */
}

.box-content {
    background: rgba(255, 255, 255, 0.8);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px dashed #7f8c8d;
    border-radius: 4px;
}

.box-content p {
    margin: 2px 0;
    font-size: 0.9em;
    font-weight: 500;
}

.box-dimensions {
    background: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    margin-top: 10px;
}

/* 可视化表示 */
.visual-representation {
    margin: 40px 0;
    text-align: center;
}

.visual-box {
    display: inline-block;
    position: relative;
    margin: 20px 0;
}

.margin-area {
    background-color: rgba(52, 152, 219, 0.1);
    border: 2px dashed #3498db;
    padding: 30px;
    border-radius: 8px;
}

.border-area {
    background-color: rgba(231, 76, 60, 0.1);
    border: 5px solid #e74c3c;
    padding: 20px;
    border-radius: 5px;
}

.padding-area {
    background-color: rgba(46, 204, 113, 0.1);
    padding: 15px;
    border-radius: 3px;
}

.content-area {
    background-color: #f9e79f;
    padding: 30px;
    border: 1px solid #f1c40f;
    border-radius: 2px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.area-label {
    font-weight: bold;
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

/* 属性详解区域 */
.box-properties {
    margin-top: 40px;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.property-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    transition: transform 0.3s ease;
}

.property-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.property-item h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.property-item p {
    color: #7f8c8d;
    font-size: 0.95em;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .model-comparison {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .properties-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.box-model-example, .visual-representation, .box-properties {
    animation: fadeIn 0.6s ease-out;
}